import request from '@/utils/request'

// 注册设计师
export function register(data: any) {
  return request({
    url: '/designer',
    method: 'post',
    data
  })
}

// 获取本人设计师信息
export function getMyDesignerInfo() {
  return request({
    url: '/designer/me',
    method: 'get'
  })
}

// 获取设计师信息
export function getDesignerInfo(id: number | string) {
  return request({
    url: `/designer/id/${id}`,
    method: 'get'
  })
}

// 获取专辑列表
export function getAlbumInfo(fdid: number | string, page?: number) {
  let params = { page: page ? page : 1 }
  return request({
    url: `/designer/${fdid}/album`,
    method: 'get',
    params
  })
}

// 获取专辑详情
export function getAlbum(waid: number | string) {
  return request({
    url: `/designer/album/${waid}`,
    method: 'get',
  })
}

// 获取作品详情
export function getWorks(dwid: number | string) {
  return request({
    url: `/designer/works/${dwid}`,
    method: 'get',
  })
}

// 发布设计作品
export function publishWorks(waid: number | string, data: any) {
  return request({
    url: `/designer/me/album/${waid}/works`,
    method: 'post',
    data
  })
}

// 创建专辑
export function createAlbum(data: FormData) {
  return request({
    url: '/designer/me/album',
    method: 'post',
    headers: {
        'Content-Type': 'multipart/form-data'
    },
    data
  })
}

// 删除专辑
export function deleteAlbum(waid: number | string) {
  return request({
    url: `/designer/me/album`,
    method: 'delete',
    params: {
      waid
    }
  })
}